package com.adapter;

import java.util.ArrayList;
import java.util.List;

import com.adapter.VideoListAdapter.GetCSDNLogoTask;
import com.adapter.VideoListAdapter.ViewHolder;
import com.entity.Navigation;
import com.entity.PackNumber;
import com.videoplayer.R;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class GridViewAdapter extends BaseAdapter {

	private List<PackNumber> list = new ArrayList<PackNumber>() ;
	private ViewHolder viewHolder;
	private Context c;
	private String flag ;

	public GridViewAdapter(Context c, List<PackNumber> list) {
		this.c = c;
		this.list = list;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public PackNumber getItem(int arg0) {
		return list.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	public void setFlag(String i) {
		flag = i;
	}

	@Override
	public View getView(int arg0, View convertView, ViewGroup arg2) {

		if (convertView == null) {
			convertView = View.inflate(c, R.layout.grid_view_item, null);
			viewHolder = new ViewHolder();
			viewHolder.title = (TextView) convertView
					.findViewById(R.id.tv_pac_num);
			convertView.setTag(viewHolder);
		} else {
			viewHolder = (ViewHolder) convertView.getTag();
		}
		if (list != null) {
			viewHolder.title.setText(list.get(arg0).getText());
//			if (flag.equals(viewHolder.title.getText()))
//				viewHolder.title.setTextColor(0xFF00d0fd);
//			else
//				viewHolder.title.setTextColor(0xFFFFFFFF);
			
		}
		return convertView;
	}

	static class ViewHolder {
		private TextView title;
	}

}
